﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link rel="Stylesheet" type="text/css" media="screen" href="Screen.css" />
  <title>STP_OnBpduReceived</title>
</head>
<body>
	<h3>STP_OnBpduReceived</h3>
	<hr />
<pre>
void STP_OnBpduReceived
(
    BRIDGE*              bridge,
    int                  portIndex,
    const unsigned char* bpdu,
    int                  bpduSize,
    unsigned long        timestampMilliseconds
);
</pre>
	<h4>
		Summary</h4>
	<p>
		Function which the application must call upon receiving a BPDU packet from a physical 
		port.</p>
	<h4>
		Parameters</h4>
	<dl>
		<dt>bridge</dt>
		<dd>Pointer to a BRIDGE object, obtained from <a href="STP_CreateBridge.html">
			STP_CreateBridge</a>.</dd>
		<dt>portIndex</dt>
		<dd>The index of the port from which this BPDU was received. This information is usually 
			generated by the hardware and received via the Ethernet driver.</dd>
		<dt>bpdu</dt>
		<dd>Pointer to the BPDU payload, located in an Ethernet frame just after the LLC field.</dd>
		<dt>bpduSize</dt>
		<dd>Size of the BPDU payload.</dd>
		<dt>timestampMilliseconds</dt>
		<dd>A value representing the number of milliseconds elapsed since firmware startup. Used 
			only for the debug log. </dd>
	</dl>
	<h4>
		Remarks</h4>
		<p>
			Execution of this function is a potentially lengthy process. 
			It may call various callbacks multiple times.</p>
		
	<p>
		It is allowed to call this function for stopped bridges. In this case it will ignore the BPDU and return immediately.</p>
	<p>
		This function validates the length of the BPDU before processing its content. It ignores 
		truncated BPDUs.</p>
	<p>
		This function does not support &quot;Config&quot; BPDUs, nor does it support Topology Change 
		Notification (TCN) BPDUs. When such a BPDU is passed to the library code, it will cause an 
		assertion failure (if the assertions were enabled in the build options), or it will 
		otherwise ignore that BPDU. Config and TCN BPDUs are only sent by devices running very old 
		versions of STP (pre-RSTP). The library does not support interacting with such devices and 
		does not support falling back to this pre-RSTP protocol; it will most likely never support 
		this functionality.</p>
		
	<p>
		It is recommended that the application, <em>after</em> receiving a BPDU from the bridge IC 
		and <em>before</em> passing the BPDU to this function, checks that it has up-to-date 
		information about the &quot;operational&quot; status of the physical port from which it received the 
		BPDU. Depending on the hardware particularities, it is possible that an application first
		<strong>1)</strong> receives an Ethernet packet from a physical port, and then <strong>2)</strong> 
		receives information from that port about the link having just been established (e.g., 
		cable just connected). If the application finds itself in this condition upon receiving a 
		BPDU, it should first call <a href="STP_OnPortEnabled.html">STP_OnPortEnabled</a>, and only 
		then STP_OnBpduReceived.</p>
		
	</body>
</html>
